package com.le.tester.book.concurrentchallenge.safety;

import javax.servlet.*;
import java.io.IOException;

/**
 * currentTime:2022/3/8 14:24
 * description:不安全使用
 */
public class UnsafeCountingFactorizer implements Servlet {

    private long count = 0;


    public long getCount() {
        return count;
    }

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {

        //读取；修改；写入
        ++count;
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
